<title>应用列表</title>
<div class="layui-fluid">
    <div class="layui-col-md12">
        <form class="layui-form layui-col-md11">
            <div class="layui-form-item">
                <div class="layui-input-inline">
                    <input name="searchName" placeholder="请输入应用名称" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-input-inline">
                    <a class="layui-btn" lay-submit lay-filter="find">查询</a>
                </div>
            </div>
        </form>
        <a class="layui-btn layui-col-md1" lay-submit lay-filter="showAdd">新增</a>
    </div>
    <!--弹出层-->
    <form class="layui-form" style='display:none;' id="add_edit_form">
        <div class="layui-form-item">
            <label class="layui-form-label">套餐名称</label>
            <div class="layui-input-inline">
                <input name="name" required lay-verify="required" placeholder="请输入套餐名称" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">应用</label>
            <div class="layui-input-inline">
                <select name="app_id" id="app_id" lay-verify="required"></select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">套餐图片</label>
            <div class="layui-input-block">
					<span class="layui-col-md12" style="position:relative; display:block;">
						<a class="layui-btn layui-col-md4" id="putAddBtn">上传</a>
						<input id="addImgPut" type="file">
					</span>
                <img id="DocumentScreenImgPut">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">套餐级别</label>
            <div class="layui-input-block">
                <input name="level" required lay-verify="required" placeholder="请输入套餐级别" autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <!--不需要买，都是免费的-->
        <!--<div class="layui-form-item">-->
            <!--<label class="layui-form-label">金额</label>-->
            <!--<div class="layui-input-block">-->
                <!--<input name="money" required lay-verify="required|number" placeholder="请输入套餐金额" autocomplete="off"-->
                       <!--class="layui-input">-->
            <!--</div>-->
        <!--</div>-->
        <!--现在为永久，不需要过期天数-->
        <!--<div class="layui-form-item">-->
            <!--<label class="layui-form-label">过期天数</label>-->
            <!--<div class="layui-input-block">-->
                <!--<input name="expired_days" required lay-verify="required|number" placeholder="请输入过期天数" autocomplete="off"-->
                       <!--class="layui-input">-->
            <!--</div>-->
        <!--</div>-->
        <div class="layui-form-item">
            <label class="layui-form-label">详细说明</label>
            <div class="layui-input-block">
                <textarea name="detail_info" required lay-verify="required" placeholder="请输入详细说明"
                          class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <input type="checkbox" name="add_edit_status" checked lay-skin="switch" lay-text="开启|关闭">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <a class="layui-btn" id="btn" lay-submit lay-filter="sub">提交</a>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
        <input name="add_edit_type" style="display: none;"/>
    </form>
    <!--当前操作的id-->
    <input name="operationId" style="display: none;"/>
    <!--数据表格-->
    <div class="layui-col-md12">
        <table id="pageTable" lay-filter="pageTable" lay-data="{id: 'pageTable'}">
        </table>
    </div>
</div>
<!--添加/编辑签名-->
<script type="text/javascript">
    layui.use('application/combo', layui.factory('application/combo'));
</script>
<script type="text/html" id="operations">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
</script>
<!--图片模板-->
<script type="text/html" id="imgTpl">
    <img class="layui-upload-img" style="width:40px; height:40px" src={{ d.pic_url }}>
</script>
<!--金额模板-->
<!--<script type="text/html" id="moneyTpl">-->
    <!--<span>{{ parseFloat(d.money) }}&nbsp;元</span>-->
<!--</script>-->
<!--状态码模板-->
<script type="text/html" id="statusTpl">
    <input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="status" {{
           d.status== 1 ? 'checked' : '' }}>
</script>
<!--应用类型模板-->
<script type="text/html" id="typeTpl">
    {{#  if(d.type == '1'){ }}
    <span class="layui-col-md8">微信</span>
    {{#  } else if(d.type == '2'){ }}
    <span class="layui-col-md8">小程序</span>
    {{#  } else if(d.type == '3'){ }}
    <span class="layui-col-md8">微信&小程序</span>
    {{#  } else { }}
    <span class="layui-col-md8">类型错误</span>
    {{#  } }}
</script>
<style>
    #add_edit_form {
        margin-top: 20px;
        margin-right: 20px;
    }

    tbody > tr {
        height: 60px;
    }

    .layui-table-cell {
        height: auto;
    }

    #DocumentScreenImgPut {
        height: 200px;
        width: 200px;
        margin-top: 10px;
        border: 1px solid #e5e5e5;
    }

    input[id=addImgPut] {
        border: 0px solid red;
        position: absolute;
        left: 0px;
        top: 0px;
        opacity: 0;
        height: 36px;
        width: 200px;
    }

    input[id=addImgPut] :hover {
        cursor: pointer;
    }
</style>
